package com.kotlin.demo.集合框架.list

fun main() {

    val list = mutableListOf("luoLin", "JinHong", "ZhuNing")

    list.add("aaa")
    list.remove("aaa")

    //不支持变化操作
    val list1 = listOf("luoLin", "JinHong", "ZhuNing")
//    list1.add()
//    list1.remove("")

    list.toList() // multableList to unMultableList
    list1.toMutableList() // unMultableList to multableList


    list.removeIf { it.contains("l") }
    println(list)


    //元素的三种遍历方式
    for (i in list){
        println(i)
    }

    list.forEach {
        println(it)
    }


    list.forEachIndexed { index, value ->
        println("index:$index == value:$value")
    }





}

